package com.mxpio.erp.common.oa.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.annotation.DictValue;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = "MB_ERP_OA_RESIGN_APPLY")
@Schema(description = "离职申请表")
public class ResignApply extends BaseEntity {


    @Id
    @Column(name = "BIZ_NO_", updatable = false)
    @Generator(policy = ResCodeGeneratorPolicy.class)
    @Schema(description = "工单编号")
    private String bizNo;

    @Column(name = "EMPLOYEE_NAME_")
    @Schema(description = "员工工号")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String employeeId;

    @Column(name = "DEPT_CODE_")
    @Schema(description = "部门编号")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String deptCode;

    @Column(name = "POST_")
    @Schema(description = "员工岗位")
    private String post;

    @Column(name = "DEGREE_")
    @Schema(description = "学历")
    @Dict(dicCode = "MB_ERP_HR_EMPLOYEE_DEGREE")
    private String degree;

    @Schema(description = "联系方式")
    @Column(name = "MOBILE_")
    private String mobile;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Schema(description = "离职时间")
    @Column(name = "RESIGN_TIME_")
    private Date resignTime;

    @Schema(description = "离职类型")
    @Column(name = "RESIGN_TYPE_")
    @Dict(dicCode = "MB_ERP_OA_RESIGN_TYPE")
    @DictValue("10=因合同期满，本人拟不再与公司续约,20=因其他理由辞职")
    private String resignType;

    @Schema(description = "其他离职类型")
    @Column(name = "OTHER_RESIGN_TYPE_")
    @Dict(dicCode = "MB_ERP_OA_RESIGN_OTHER_TYPE")
    @DictValue("10=工作负担重,20=工资收入低,30=无晋升机会,40=不适公司管理方式,50=升学,60=人际关系,70=进入其他公司,80=出国,90=健康原因,100=家庭原因,110=其他原因")
    private String otherResignType;

    @Schema(description = "其他离职原因")
    @Column(name = "OTHER_RESIGN_REASON_")
    private String otherResignReason;

    @Schema(description = "对公司建议")
    @Column(name = "TO_COMPANY_SUGGESTION_")
    private String toCompanySuggestion;
    /**
     * 审批状态
     */
    @Column(name = "BPMN_STATUS_")
    @Schema(description = "审批状态")
    @Dict(dicCode = "ERP_COMMON_BPMN_STATUS")
    private String bpmnStatus;

    /**
     * 审批实例ID
     */
    @Column(name = "PROCESS_INSTANCE_ID_")
    @Schema(description = "审批实例ID")
    private String processInstanceId;
}
